package com.laozhao.deliveryManager.model.entity;

import java.math.BigDecimal;
import java.util.Calendar;
import java.util.Date;

import com.laozhao.deliveryManager.exception.NumberTooBigException;
import com.laozhao.deliveryManager.model.AbstractModel;
import com.laozhao.deliveryManager.util.Trans2RMB;
import com.laozhao.dreamframe.model.DreamDBColumn;

public class TransDeliveryMain extends AbstractModel{
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 4530418065533351416L;
	
	@DreamDBColumn( dbColunName = "CUSTOMER_ID")
	private MstCustomerCom customer;
	@DreamDBColumn( dbColunName = "CUSTOMER_NAME")
	private String customerName ;
	@DreamDBColumn( dbColunName = "CUSTOMER_ADDRESS")
	private String customerAddress;
	
	@DreamDBColumn( dbColunName = "DELIVERY_NO")
	private String DelNo ;
	@DreamDBColumn( dbColunName = "SEND_DATE" )
	private Date sendDate;
	@DreamDBColumn( dbColunName = "AMOUNT" )
	private Float amount;
	@DreamDBColumn( dbColunName = "SEND_USER" )
	private String user;
	@DreamDBColumn( dbColunName = "STATUS" )
	private int status;
	
	
//	public int viewYear;
//	public int viewMon;
//	public int viewDay;
	
	public String getDelNo() {
		return DelNo;
	}
	public void setDelNo(String delNo) {
		DelNo = delNo;
	}
	public Date getSendDate() {
		return sendDate;
	}
	public void setSendDate(Date sendDate) {
		this.sendDate = sendDate;
	}
	public Float getAmount() {
		return amount;
	}
	public void setAmount(Float amount) {
		this.amount = amount;
	}
	public String getUser() {
		return user;
	}
	public void setUser(String user) {
		this.user = user;
	}
	public int getStatus() {
		return status;
	}
	public void setStatus(int status) {
		this.status = status;
	}
	public MstCustomerCom getCustomer() {
		return customer;
	}
	public void setCustomer(MstCustomerCom customer) {
		this.customer = customer;
	}

	public String getCustomerName() {
		return customerName;
	}
	public void setCustomerName(String customerName) {
		this.customerName = customerName;
	}
	public String getCustomerAddress() {
		return customerAddress;
	}
	public void setCustomerAddress(String customerAddress) {
		this.customerAddress = customerAddress;
	}

	
	public int getViewYear() {
		Calendar cal = Calendar.getInstance();
		cal.setTime(sendDate);
		return cal.get(Calendar.YEAR);
	}
	public int getViewMon() {
		Calendar cal = Calendar.getInstance();
		cal.setTime(sendDate);
		return cal.get(Calendar.MONTH);
	}
	public int getViewDay() {
		Calendar cal = Calendar.getInstance();
		cal.setTime(sendDate);
		return cal.get(Calendar.DAY_OF_MONTH);
	}
	
	public String getViewAmount() throws NumberTooBigException{
		if (amount != null) {
			return new Trans2RMB(new BigDecimal(amount)).trans();
		}else {
			return "";
		}
	}
}
